﻿import QtQuick 2.0
import QtQuick.Controls 2.0
import "./utils" as Utils

Item {
    id:rootItem
    signal backIndex()
    property var pageIndex:1;
    Rectangle{
        id: swipView
        width: parent.width
        height: 1080
        color: "#1F2A37"
        DriveRect{
            id: drivePage
            state: rootItem.state
            visible:rootItem.pageIndex === 1
        }
        SetRect{
            id: infoRect
            state: rootItem.state
            visible:rootItem.pageIndex === 2
        }
    }
    Utils.MyDriverInfo{
        id:myDriverInfo
        anchors.bottom: parent.bottom
        visible: swipeView.currentIndex === 3
        view_model: 2
        onViewChanged:{
            switch(view_model)
            {
                case 1:
                    break
                case 2:
                    rootItem.pageIndex = 1
                    break
                case 3:
                    rootItem.pageIndex = 2
                    break
                default:
                    break
            }
        }
        Image{
            anchors.right: parent.right
            anchors.verticalCenter: parent.verticalCenter
            anchors.rightMargin: 50
            source: "qrc:/imgs/back.png"
            width: 45
            height: 45
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    rootItem.backIndex()
                }
            }
        }
    }

}
